package com.imooc.controller.superadmin;

import com.imooc.entity.bo.HeadLine;
import com.imooc.entity.dto.Result;
import com.imooc.service.solo.HeadLineService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author 折戟沉沙铁未销
 * @version V1.0
 * @date 2020/7/7-2020
 * @Description:
 */
public class HeadLineOperationController {

    private HeadLineService headLineService;

    /**
     * 增加头条
     * @param request
     * @param response
     * @return
     */
    public Result<Boolean> addHeadLine(HttpServletRequest request, HttpServletResponse response){
        //TODO 参数校验以及请求参数转化
        return headLineService.addHeadLine(new HeadLine());
    }

    /**
     * 删除头条
     * @param request
     * @return
     */
    public Result<Boolean> removeHeadLine(HttpServletRequest request, HttpServletResponse response){
        //TODO 参数校验以及请求参数转化
        return headLineService.removeHeadLine(1);
    }

    /**
     * 修改头条
     * @param request
     * @param response
     * @return
     */
    public Result<Boolean> modifyHeadLine(HttpServletRequest request, HttpServletResponse response){
        //TODO 参数校验以及请求参数转化
        return headLineService.modifyHeadLine(new HeadLine());
    }

    /**
     * 根据id查询HeadLine 头条对象
     * @param request
     * @param response
     * @return
     */
    public Result<HeadLine> queryHeadLineById(HttpServletRequest request, HttpServletResponse response){
        //TODO 参数校验以及请求参数转化
        return headLineService.queryHeadLineById(1);
    }

    /**
     * 查询头条对象集合
     * @param request
     * @param response
     * @return
     */
    public Result<List<HeadLine>> queryHeadLine(HttpServletRequest request, HttpServletResponse response){
        //TODO 参数校验以及请求参数转化
        return headLineService.queryHeadLine(new HeadLine(),1,10);
    }
}
